<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            width: 100%;
            height: 100vh;
            /* background: linear-gradient(to right, #f64f59, #c471ed, #12c2e9); */
            background-color: black;
        }

        .background {
            position: absolute;
            top: 0;
            left: 0;
            z-index: 999;
        }
    </style>
</head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/particlesjs/2.2.2/particles.min.js"></script>

<body>
    <canvas class="background"> </canvas>
</body>
<script>
    window.onload = function () {
        Particles.init({
            // 选择canvas画布元素
            selector: '.background',
            // 设置最大粒子数
            maxParticles: 150,
            // 设置粒子的移动速度
            speed: 0.5,
            //粒子大小
            sizeVariations:3,
            // 设置粒子颜色
            color: '#8ACAFF',
            // 开启点连线
            connectParticles: true,
            // 设置
            minDistance: 100,
            // 设置响应式配置项的调整
            responsive: [{
                // 当浏览器窗口宽小于768像素大小采用以下配置
                breakpoint: 768,
                options: {
                    maxParticles: 100,
                    color: '#9400D3',
                    connectParticles: false
                }
            }, {
                // 当浏览器窗口宽小于425像素大小采用以下配置
                breakpoint: 425,
                options: {
                    maxParticles: 100,
                    connectParticles: true
                }
            }, {
                // 当浏览器窗口宽小于320像素大小采用以下配置
                breakpoint: 320,
                options: {
                    maxParticles: 0
                }
            }]

        })
    }
</script>

</html>